function res = GetXeRelaxation(obj, duration, varargin)
    import MeasurementComponent.Signal.*
    
    p=inputParser;
    p.addRequired('duration', @(x) x>0);
    p.addParameter('rate', 1, @(x) x>0);
    p.addParameter('bandwidth', 5.0, @(x) x>0.0);
    p.addParameter('isReport', false, @islogical);
    p.addParameter('isPlot', true, @islogical);
    p.addParameter('description', 'normal', @ischar);
    p.parse(duration, varargin{:});
    
    %%
    obj.UnlockXe129(); obj.UnlockXe131();
    obj.setRFMagnetometer('field', obj.SystemInfo.MainField.bz0, 'bandwidth', p.Results.bandwidth);

    obj.rbSignal.unsubscribe_signal();
    obj.rbSignal.subscribe_signal(ziDemodTime.R, [2 1 1]);
    obj.rbSignal.subscribe_signal(ziDemodTime.Theta, [2 1 2]);
    signal0 = obj.rbSignal.getDemodSignal(5, 'rate', p.Results.rate);
    
    obj.aom.disable();
    obj.rbSignal.unsubscribe_signal();
    obj.rbSignal.subscribe_signal(ziDemodTime.R, [2 1 1]);
    obj.rbSignal.subscribe_signal(ziDemodTime.Theta, [2 1 2]);
    signal = obj.rbSignal.getDemodSignal(p.Results.duration, 'rate', p.Results.rate);

    %% Fit
    dataRef = signal0.getNodeData(1);
    reference = mean(dataRef.y);
    
    data = signal.getNodeData(1);
    [xData, yData] = prepareCurveData( data.x, data.y);

    minY = min(yData); maxY = max(yData);
    a0 = maxY-minY; c0 = minY; tau0 = mean(xData);

    ft = fittype( 'a*exp(-x/tau)+c', 'independent', 'x', 'dependent', 'y' );
    opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
    opts.Display = 'Off';
    opts.Robust = 'LAR';
    opts.StartPoint = [a0      c0    tau0];

    [fitting.result, fitting.gof] = fit( xData, yData, ft, opts );
    
    res.timestamp = datetime('now');
    res.signal.reference = signal0;
    res.signal.relaxation = signal;
    res.fitting = fitting;
    res.T1 = fitting.result.tau;
    res.amplitude = fitting.result.a;
    res.reference = reference;
    obj.SystemInfo.Xe129Relaxation = res;

    if p.Results.isPlot
        fig = obj.PlotXeRelaxation();
    end
    %%
    if p.Results.isReport
        getReporter;
        rpt.NewRecord(['XeRelaxation_' p.Results.description]);
        if p.Results.isPlot
            rpt.AppendFigure(fig, sprintf('XeRelaxation %s', p.Results.description));
        end
    end
    %%
    getSession;
    sess.addData('XeRelaxation', res, p.Results.description);
end

